from core import BaseHandler;
from messages import ProtocalTypes;

class AddHandler(BaseHandler):
    
    def process(self,protocal):
        if(not protocal):
            pass
        
        return {'type':ProtocalTypes.SC_ADD,'data':protocal.right+protocal.left};
    
class SubHandler(BaseHandler):
    
    def process(self,protocal):
        if(not protocal):
            pass
        
        return {'type':ProtocalTypes.SC_SUB,'data':protocal.left-protocal.right};
    
class MulHandler(BaseHandler):
    
    def process(self,protocal):
        if(not protocal):
            pass
        
        return {'type':ProtocalTypes.SC_MUL,'data':protocal.right*protocal.left};
    
class DivHandler(BaseHandler):
    
    def process(self,protocal):
        if(not protocal):
            pass
        if(protocal.right == 0) :
            result = 999999999
        else:
            result = protocal.left/protocal.right;
        return {'type':ProtocalTypes.SC_DIV,'data':result};